package com.zby.filter.vo.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * Created By zby on 17:02 2019/1/30
 * 爱好
 */

public enum HobbyEnum implements TitleEnum {

    HOBBY_DANCING("跳舞"),
    HOBBY_SINGING("唱歌"),
    HOBBY_DRAWING("画画"),
    HOBBY_PHOTO("拍照"),
    HOBBY_LISTENING_MUSIC("听音乐"),
    HOBBY_WATCH_MOVIE("看电影"),
    HOBBY_SWIMMING("游泳");

    private String title;


    HobbyEnum(String title) {
        this.title = title;
    }

    @Override
    public String getTitle() {
        return title;
    }

    public static HobbyEnum getByEnumName(final Object enumName) {
        for (HobbyEnum hobbyEnum : HobbyEnum.class.getEnumConstants()) {
            if (hobbyEnum.equals(enumName))
                return hobbyEnum;
        }
        return null;
    }

    public static Map<String, String> getName2TitleMap() {
        Map<String, String> map = new HashMap<>();
        for (HobbyEnum hobbyEnum : HobbyEnum.class.getEnumConstants()) {
            map.put(hobbyEnum.name(), hobbyEnum.title);
        }
        return map;
    }

}
